<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:rich="http://richfaces.org/rich">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>资产处置表</title>
        <style type="text/css">
            input[type='submit']{
                margin: 3px 5px 3px 5px;
                padding:3px 5px 3px 5px;
            }
        </style>
    </h:head>
    <h:body>
        <h:form id="emp">
            <rich:panel header="资产处置表" styleClass="content-hight">
                <h:panelGrid columns="2">
                    <h:outputLabel value="部 门: " />
                    <h:selectOneMenu  value="#{assetDealBean.asset.dept.code}"
                                      valueChangeListener="#{deptAndEmp.deptChange1}">
                        <f:selectItem itemValue="" itemLabel="-请选择-"/>
                        <f:selectItems value="#{deptAndEmp.selectItemList}"/>
                        <a4j:ajax event="change" render="usern"/>
                    </h:selectOneMenu>
                    <h:outputLabel value="使用人: " />
                    <h:panelGroup id="usern">
                        <h:selectOneMenu  id="ausername"   value="#{assetDealBean.asset.person.cpsn_name}">
                            <f:selectItem itemValue="" itemLabel="-请选择-"/>
                            <f:selectItems value="#{deptAndEmp.person}" />
                        </h:selectOneMenu>
                    </h:panelGroup>
                    <h:outputLabel value="使用状况: " />
                    <h:panelGroup>
                        <h:selectOneMenu  id="usestatus"   value="#{assetDealBean.asset.useStatus}">
                            <f:selectItem itemValue="" itemLabel="-请选择-"/>
                            <f:selectItem itemValue="0" itemLabel="在用"/>
                            <f:selectItem itemValue="1" itemLabel="报废"/>
                            <f:selectItem itemValue="2" itemLabel="报损"/>
                            <f:selectItem itemValue="3" itemLabel="其他"/>
                        </h:selectOneMenu>
                    </h:panelGroup>
                </h:panelGrid>
                <a4j:commandButton value="查询" action="#{assetDealBean.queryList}" render="dataGroup,totalNum"/>
                <h:commandButton value="导出Excel" action="#{assetDealBean.exportExcel}"/>
                <hr/>
                <h:panelGroup id="dataGroup">
                    <rich:dataScroller for="assetListTable"/>
                    <div style="width:750px; min-height:260px; overflow:auto">
                        <rich:dataTable id="assetListTable"
                                                value="#{assetDealBean.assetlist}" var="asset"
                                                rowClasses="list-row-odd,list-row-even"
                                                headerClass="table-header"
                                                style="width:1000px;"
                                                rows="10">
                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="序号"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText  value="#{asset.id}" />
                            </rich:column>
                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="资产编号"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText  value="#{asset.assetCode}" />
                            </rich:column>
                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="设备名称"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{asset.assetName}" />
                            </rich:column>
                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="部门"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{asset.dept.name}" />
                            </rich:column>
                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="使用人"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{asset.person.cpsn_name}" />
                            </rich:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText  value="规格型号"/>
                                </f:facet>
                                <h:outputText value="#{asset.model}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText  value="数量"/>
                                </f:facet>
                                <h:outputText value="1"/>
                            </h:column>
                           
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText  value="单价"/>
                                </f:facet>
                                <h:outputText value="#{asset.price}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText  value="金额"/>
                                </f:facet>
                                <h:outputText value="#{asset.price}"/>
                            </h:column>
                            
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText  value="使用状况"/>
                                </f:facet>
                                <h:outputText value="在用"  rendered="#{asset.useStatus == '0'}" style="color:darkseagreen;"/>
                                <h:outputText value="报废"  rendered="#{asset.useStatus == '1'}" style="color:blue;"/>
                                <h:outputText value="报损"  rendered="#{asset.useStatus == '2'}" style="color:red;"/>
                                <h:outputText value="其他"  rendered="#{asset.useStatus == '3'}" style="color:grey;"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText  value="备注"/>
                                </f:facet>
                                <h:outputText value="#{asset.memo}"/>
                            </h:column>
                        </rich:dataTable>                        
                    </div>
                </h:panelGroup>
                <h:panelGrid columns="4" id="totalNum" >
                        <h:outputLabel value="报废数: " />
                        <h:outputText value="#{assetDealBean.bftotal}"/>
                        <h:outputLabel value="金额: " />
                        <h:outputText value="#{assetDealBean.bfmoney}"/>
                        <h:outputLabel value="报损数: " />
                        <h:outputText value="#{assetDealBean.bstotal}"/>
                        <h:outputLabel value="金额数: " />
                        <h:outputText value="#{assetDealBean.bsmoney}"/>
                        <h:outputLabel value="总计数: " />
                        <h:outputText value="#{assetDealBean.bftotal + assetDealBean.bstotal}"/>
                        <h:outputLabel value="总计金额: " />
                        <h:outputText value="#{assetDealBean.bfmoney + assetDealBean.bsmoney}"/>
                         </h:panelGrid>
            </rich:panel>
        </h:form>
    </h:body>
</ui:composition>

